$(function(){
    //返回顶部按钮
    $('body').append('<div class="container to-top"><p id="back-to-top"><a title="" href="#top"><i class="fa fa-arrow-up fa-2x"></i></a></p></div>')
    $("#back-to-top").hide();
        $(window).scroll(function() {
            if ($(window).scrollTop() > 100) {
                $("#back-to-top").fadeIn('fast');
            } else {
                $("#back-to-top").fadeOut('fast');
            }
        });
        $("#back-to-top").click(function() {
            $('body,html').animate({
                scrollTop: 0
            },
            1000);
            return false;
        });  
    //语言选择    
    $("#language").on('click','a',function(){
          language=$(this).attr('language');
          setCookie('home_language',language,'30');
          window.location.reload();
        })     
    //瀑布流布局
    $('[data-toggle="masonry"]').masonry({
        itemSelector: '.masonry-item'
      });
    if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))){
        new WOW({
            boxClass: 'muthink-animate',
            animateClass: 'animated',
            offset: 20,
            mobile: true,
            live: true
        }).init();
    };
})
function setCookie(c_name,value,expiredays){
    var exdate=new Date()
    exdate.setDate(exdate.getDate()+expiredays)
    document.cookie=c_name+ "=" +escape(value)+
    ((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}
